package br.ufms.odontologico.bo;

import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.ViewScoped;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Query;

import br.ufms.odontologico.model.Convenio;

@ViewScoped
@ManagedBean
public class ConvenioBO {
	@ManagedProperty("#{genericBO}")
	private GenericBO<Convenio> gbo; 
	
	
	@SuppressWarnings("unchecked")
	public List<Convenio> listAll() {
		Query qr = getEm().createQuery("from Convenio");
		Object obj = qr.getResultList();
		return (obj instanceof List<?>) ?((List<Convenio>) obj) :null;
	}
	
	
	
	

	public Boolean delete(Convenio obj) {
		return getGbo().delete(obj);
	}

	public Boolean delete(List<Convenio> obj) {
		return getGbo().delete(obj);
	}

	public boolean equals(Object arg0) {
		return getGbo().equals(arg0);
	}

	public EntityManager getEm() {
		return getGbo().getEm();
	}

	public EntityManagerFactory getEmf() {
		return getGbo().getEmf();
	}

	public int hashCode() {
		return getGbo().hashCode();
	}

	public Boolean insert(Convenio obj) {
		return getGbo().insert(obj);
	}

	public void setEmf(EntityManagerFactory emf) {
		getGbo().setEmf(emf);
	}

	public String toString() {
		return getGbo().toString();
	}

	public Convenio update(Convenio obj) {
		return getGbo().update(obj);
	}

	public Convenio updateOnly(Convenio obj) {
		return getGbo().updateOnly(obj);
	}





	public GenericBO<Convenio> getGbo() {
		return gbo;
	}





	public void setGbo(GenericBO<Convenio> gbo) {
		this.gbo = gbo;
	}


}
